import 'package:flutter_vant/main.dart';
import 'package:flutter/material.dart';

class VanNavBar extends HookWidget implements PreferredSizeWidget {
  final Color backgroundColor;
  final String title;
  const VanNavBar(
      {Key? key, this.backgroundColor = Colors.white, this.title = ''})
      : super(key: key);

  @override
  Size get preferredSize => Size(1, 50);

  @override
  PreferredSizeWidget build(BuildContext context) {
    return AppBar(
      leading: IconButton(
        icon: const Icon(
          Icons.arrow_back_ios,
          size: 20,
          color: Colors.black,
        ),
        onPressed: () {
          Navigator.pop(context);
        },
      ),
      title: TextView(
        title,
        styles: const {CssRule.fontSize: 15},
      ),
      backgroundColor: Colors.white,
      elevation: 0.5,
    );
  }
}
